<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head>
	<th:block th:include="include :: header('')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-mqExchanges-edit" th:object="${mqExchanges}">
            <input id="exchangesId" name="exchangesId" th:field="*{exchangesId}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">交换机名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text" th:field="*{name}">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">类型：</label>
				<div class="col-sm-8">
					<select id="type" name="type" class="form-control" th:with="type=${@dict.getType('rabbitmq_exchange_type')}">
					  <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{type}">
					  </option>
					</select>
					<p><span style="color: red;">Direct</span>:(点对点模式)处理路由键，需要将一个队列绑定到交换机上，要求该消息与一个特定的路由键完全匹配。</p>
					<p><span style="color: red;">Topic</span>:将路由键和某模式进行匹配。此时队列需要绑定要一个模式上。符号“#”匹配一个或多个词，符号“*”只能匹配一个词。</p>
					<p><span style="color: red;">Fanout</span>:(广播模式)Fanout 不处理路由键。你只需要简单的将队列绑定到交换机上。一个发送到该类型交换机的消息都会被广播到与该交换机绑定的所有队列上。</p>
					<p><span style="color: red;">Headers</span>:不处理路由键，而是根据发送的消息内容中的headers属性进行匹配。不常用</p>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">是否持久化：</label>
				<div class="col-sm-8">
					<select id="durability" name="durability"  class="form-control" th:with="type=${@dict.getType('rabbitmq_exchange_durability')}">
					  <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{durability}">
					  </option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">是否自动删除：</label>
				<div class="col-sm-8">
					<select id="autoDelete" name="autoDelete"  class="form-control" th:with="type=${@dict.getType('rabbitmq_exchange_autoDelete')}">
					  <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{autoDelete}">
					  </option>
					</select>
					<p>不再被使用时(没有任何绑定的情况下），是否由RabbitMQ自动删除</p>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">参数：</label>
				<div class="col-sm-8">
					<textarea name="arguments" autocomplete="off" maxlength="500" class="form-control" rows="3">[[*{arguments}]]</textarea>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea name="remark" id="remark" autocomplete="off" maxlength="500" class="form-control" rows="3">[[*{remark}]]</textarea>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "amqp/mqExchanges";
		$("#form-mqExchanges-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-mqExchanges-edit').serialize());
	        }
	    }
	</script>
</body>
</html>
